home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
038a
/
aplibs91.zip
/
APLIB.DOC
< prev
next >
Wrap
Text File
|
1991-05-03
|
42KB
|
797 lines
+---------------------------------------------+
| |
| |
| THE NEW HB ALL-PURPOSE LIBRARY |
| |
| FOR POWER-BASIC PROGRAMMERS |
| |
| INTRODUCTION AND DOCUMENTATION |
| |
| |
+---------------------------------------------+
Version 2.5 // SPRING 1991
compatible with: POWER BASIC v. 2.1
==================
Here it comes again !! An update of my little all purpose library of
programming tools. For those who never heard of this humble work, it
contains PB routines to allow you to write complete pulldown menu
interfaces, rodent-aware, just by copying a demo program; fancy entry
routines for string or numeric data, phone #s, dates etc (never use INPUT
again!), date arithmetic, get file dirs & diskspace, open a data-entry
window, dialog box, let users customize colors, push & pop screens, & much
more! All in PB units. Free for casual use; if you use it to make money I
do request that you send me a little. Just whatever you think it's worth.
It has happened -- and I do much appreciate it, as an acknowledgement of my
MANY hours' work as well as extra dinero.
I am a householder and non-computer professional; I do programming as a
more-or-less useful avocation. This custom routines library was written by
stages over a few years time, first for Turbo Basic (there are even echos
of GeeWhiz Basic in here), and mostly for my own use in database programs
and my custom dos shell. Also I include my do-nothing demo program which
I use to develop and demonstrate the functions in the library; this file,
HBDEMO.BAS, also contains detailed how-to instructions (embedded as
clever remarks) to help you guys (M or F) use it in your own programming
projects.
==========================================================
*---> TO CREATE AND RUN THE DEMO --
Having installed POWER BASIC 2.1 on your HD, simply
put these files in a clean directory & enter MAKEDEMO
==========================================================
*---> TO PRINT DOC: do the above, then from the main menu
select first [ F ] then [ P ] (about 10 pages)
==========================================================
FEATURES:
------
MAIN MENUS ACROSS TOP OF SCREEN AND PULLDOWN SUBMENUS -- WITH
STANDARD KEYBOARD AND MOUSE CONTROL INTERFACE.
\\ NEW: Buttons to click on at the bottom of the screen w/
Alt-key synonyms.
\\ NOW: Time-out feature works ! (In HBDEMO it blanks the screen)
Improved mouse interface. Selectable click/release mode.
POP UP AND VANISH MENUS AND DIALOG BOXES, ANYWHERE ON THE SCREEN
INPUT ROUTINES FOR TEXT FIELDS, NUMBERS, DATES ETC. W/ FULL EDITING --
SPECIAL DATE ENTRY ROUTINE THAT "SCROLLS" THE DATE FORWARD OR BACK
(starting for example with the present date) USING ARROW KEYS
FULL DATE ARITHMETIC BACK TO 1900. SPECIAL AGE FUNCTION.
POP-UP DATA ENTRY WINDOWS -- CURSOR OR TAB BACK AND FORTH FROM
FIELD TO FIELD
ROUTINES TO GET DISK, DIRECTORY AND SYSTEM INFO DIRECTLY FROM DOS
\\ NEW: Routine to read directories. Multipage menus to select
a directory and to select a filename.
SMART PRINTER CALL WITH AUTOMATIC PAGINATION, HEADERS, FOOTERS
\\ NOW: works.
AUTOMATIC DETECTION OF COLOR / MONO DISPLAY and uniform color handling.
SEPARATELY COMPILED POWER-BASIC UNITS. ALL IN BASIC FOR RELIABILITY
AND EASY MAINTENANCE, WITH EXTENSIVE ERROR-PROOFING
\\ NEW: Supports editing .BAS files with QEdit. If there's an error,
either on compile or at run-time, you are automatically
returned to QEdit at the line where the problem occurred.
________________________________________________________________________________
THE FILES AND WHAT THE HECK TO DO WITH THEM
============================
APLIB DOC The file you're reading now; part of the doc.
HBDEMO BAS This is the demo. Compile it to an EXE file using
Power Basic and you'll see about all the tricks
these units and utilities can do. Also contains
more documentation for the various procedures and
functions (as comments).
MAKEDEMO BAT automatically creates the PBU files, INC files,
PUBLIC Variables list and demo on your machine.
ENTERDEM SW { The SW files are screen design files for Static
FILEDATA SW { Windows (display text & data but no user entry).
OPENDEMO SW { The INC files are the result of processing them
COLORSET SW { through the SWW.EXE utility (see below)
{ PW files are design files for PopWindows -- data
CKWINDOW PW { entry windows. PWW makes them into INC files.
{ This demo simulates entry into a fake checkbook
{ database program. NOTE: INSTRUCTIONS FOR CREATING
{ POPWINDOWS ARE INCLUDED IN THIS PW FILE.
APLIB-H BAS Header (must $INCLUDE in all progs calling AP Lib)
APLIB-F BAS Footer (must $INCLUDE in all progs calling AP Lib)
BOXES-U BAS |
FENTRY-U BAS |
FIGDAT-U BAS | The units comprising the library.
INIT-U BAS |
MENUS-U BAS |
MISC-U BAS |
NEW-U BAS |
PUBVARS BAS | THREE UTILITIES: PWW and SWW are code generators
PWW BAS | that create *.INC files for opening the two types
SWW BAS | of data windows -- one for entry, one just to
COLORSET BAS | display data (see above). Of course the idea
| is that you can edit the .PW or .SW files all
| you want to, then reprocess them to get an
| updated display. PUBVARS automatically creates
| lists of PUBLIC variables to match the EXTERNAL
| statements in all the units linked to a
| program.
|
| COLORSET automates the process of using command
| line switches to reset the colors of the Demo
| (or any PB program that uses the SetColors
| routine). Start it and follow directions!
ERFIND BAS | These files comprise the PB - QEdit interface
PQ BAT | described above. PBD is to edit and compile
PBD BAT | HBDEMO.BAS and its accompanying files (press
2ERRORS BAS | Alt-N in QEdit to switch)
If you find an PICKADIR.LST among the files you receive, you might want
to delete it. It probably contains the directory structure of the
computer of the guy who gave you the files !
________________________________________________________________________________
NEW STUFF ADDED @ LAST UPDATE
---------------------------
Version 2.00002 was released in November '90, and worked with either PB
2.0 or 2.1. I incorporated some suggested improvements and 3 fixes into
FENTRY-U. Added SUB FASTPHONE(), much better than ENTERPHONE() and based
on a user suggestion; fixed ROTADATE() so you can choose the cursor key
system (incr/decr date) or just type in a 4 or 6-digit date without
pressing the spacebar first (thanks, Al); bulletproofing of QBox() and
BOXMESSAGE() and made a new demo routine to test them; made InsertStatus
for the entry routines a Global var. so it stays set from field to field
and made minor improvements in PWW & SWW which don't affect input or
output; wrote MAKEDEMO.BAT.
+---------------------------------------------------------------------------+
| NEW STUFF ADDED -- WINTER - SPRING 1991 |
+---------------------------------------------------------------------------+
| |
| ERFIND.BAS was written because most of my work in PowerBASIC |
| uses the command-line compiler and the shareware editor QEDIT. |
| It duplicates the handiest features of the PB environment: when |
| an error occurs in compilation OR at runtime, I'm automatically |
| taken back to the source file at the line where the error occurs! |
| |
| The operation is as follows: |
| |
| (1) If a runtime error occurs, the error handler writes up a |
| little batch file; then it stuffs its name into the keyboard |
| buffer and exits. This causes the .BAT file to run immediately |
| after the .EXE terminates. |
| |
| (2) This batch file runs PBC with the /RE parameter. PBC writes |
| the line number of the error onto the screen. Then the |
| batch file runs ERFIND, which picks the line number off the |
| screen. |
| |
| (3) ERFIND then writes another batch file to disk (preferably a |
| RAM-disk) then exits after stuffing ITS name in the keyboard |
| buffer. The batch file then starts QEdit passing the line |
| number to it behind a /G command line parameter ... and |
| after you finish editing your goof-ups, proceeds with another |
| compile / execute cycle. |
| |
| RUBE GOLDBERG LIVES !! |
| |
| (4) In the case of a compile-time error, the process starts |
| in the middle of a simple batch file (PQ.BAT) which, if it |
| detects that PBC has set ERRORLEVEL, starts ERFIND which |
| again picks the line # where the error occurred off the |
| screen. GOTO "(3)". |
| |
| Another new doodad is the procedure to find and list all the |
| subdirectories on your disk, and make them into a menu -- |
| PICKADIR$. It takes several seconds at least, so the list is |
| saved for re-use as a file (HBDEMO.DRL). |
| P.S. -- ran much faster after I defragmented my drive !! |
| |
| To go along with that there is PICKAFILE$. |
| |
| On-screen push-buttons have been added. These as well as the |
| above are in a new unit, cleverly titled NEW-U.BAS. |
| |
| New improved mouse interface! Customize response in SUPERMENU |
| (1st release, 1st click, 2nd release or whatever you & your |
| end-users want). |
| |
| Last-minute bugfix: lack of a leading zero was throwing |
| FIGDATE off. |
| |
| Also notable: the printer control procedure PRINTLINE has been |
| improved and is demonstrated in the demo (prints this file out). |
| |
| Last but Not Least -- REWRITTEN DOCUMENTATION. |
| |
| NOTE: If you still use PB version 2.0 it will take some tinkering |
| to use this version of APLIB. |
| |
+---------------------------------------------------------------------------+
There is still an initialization procedure (in INIT-U.BAS) which sets
itself up for color or mono monitor and several types of printer (you can
see what kinds of printers I've used -- there are drivers for them!). Works
on Mono, CGA, EGA & VGA in text mode. Thanks to the PB functions PEEK$ and
POKE$, screens are quickly saved to regular memory space. See SCREENPUSH
and SCREENPOP.
A NOTE ABOUT MY STYLE: You may be horrified at my use of GOTO and GOSUB in
===================== these files. Well, I don't like puzzles, I don't
care for C, and I see NO reason to use contrived outer loops and
unnecessary flag variables to avoid a simple, clear and self-evident
jump (e.g. GOTO FileSubMenu). And why, I say, incur all the overhead
of a SUB procedure, with a ton of SHARED variables to pass, and no
local variables at all ... when a GOSUB / RETURN stucture is faster
(maybe measurably, maybe no) and does the job perfectly for me and
you. Anyway, that's how I do it.
A NOTE ABOUT THE DOCUMENTATION: Really much of the good info about the
============================== use of the functions and procedures in
APLIB are to be found in the comments in the demo file, HBDEMO.BAS.
However there are some notes about each in this DOC file also. Most
of the facts agree between the two.
A NOTE ABOUT LIMITATIONS AND OTHER FAULTS: Works only in 25-line text mode.
========================================= Not optimized for code size,
obviously -- but feel free to
dig in and "hack" out unused code and trim it all you can if you like.
' ============================================================================
| |
| GETTING STARTED WRITING A POWER-BASIC |
| PROGRAM USING APLIB |
=========================================
(myself, I usually start with a copy of HBDEMO.BAS and replace all
the old works with new works)
1. $INCLUDE the file APLIB-H.BAS at the top of your file. It dimensions
some arrays, sets some named constants and variables etc. Follow that
with the seven $LINK statements.
2. Now you need the PUBLIC statements. Just include a line like: $INCLUDE
"FOO.PV" -- and then type PUBVARS FOO from the command line to automate
this chore.
3. CALL Initialize (), then GOSUB SetColors. $INCLUDE the file APLIB-F.BAS
at the end of your file. It contains the error handler and some small
subroutines.
4. If you want the full-screen menu system with pulldowns etc. the next
major APLIB call will be to TOPMENU, followed by SUPERMENU's. If you
want the main menu to time out, set TimeOut to however many seconds.
If you want push-buttons, set UseButtons to %True and define the
button data the way the demo does.
GOOD LUCK. LET ME KNOW HOW IT GOES.
' ============================================================================
QUICK REFERENCE FOR HB'S ALL-PURPOSE LIBRARY:
============================================
What's in APLIB-H.BAS ??????????
------------------------------
This is a header file which MUST be $INCLUDE'd. It doesn't contain any
executable code that I can think of -- except DIM DYNAMIC statements.
Otherwise what it has is: the DEFINT statement; %False, %True, Register
Names, Colors and other Named Constants, plus DIM statements ... etc.
Generally everything needed to set up for use of this library.
%False = 0
%True = NOT %False ' basic truths of the universe ...
%Yes = %True
%No = %False
%Background = 16
%Center = 0
%Blk = 0: %Blu = 1: %Grn = 2: %Cyn = 3: %Red = 4: %Vlt = 5
%Brn = 6: %Gry = 7: %DGry = 8: %LBlu = 9: %LGrn = 10: %LCyn = 11
%LRed = 12: %Pnk = 13: %Ylo = 14: %Wht = 15: %Flash = 256
________________________________________________________________________________
What's in APLIB-F.BAS ?????????
-----------------------------
(This "footer" file, like APLIB-H, is necessary. It contains executable
subroutines, so $INCLUDE it at the end (or at least somewhere it won't get
"fallen into")).
Oops: (error handler with new "self-debugging" features)
SetBeeps:
MZap: (clears away a pulldown menu in a mere trice)
ClickOrStrike: (waits for a key- or mouse-stroke)
SetColors:
WipeLn:
SUB Marker (Msg$) (for debugging: displays message & waits for keystroke)
________________________________________________________________________________
What's in INIT-U.BAS ???????????
-------------------------------
SUB Initialize (PrinterType)
________________________________________________________________________________
What's in FENTRY-U.BAS ??????????
--------------------------------
SUB ENTERSTRING (Wkg$,FLength,Msg$) | These are the Formatted
SUB ENTERNUMBER (Wkg#, Masq$, Msg$) | Entry routines
SUB ENTERDATE (A$, Msg$) |
SUB RotaDate (D$,Msg$) |
SUB ENTERTIME (A$, Msg$) |
SUB ENTERSSN (A$, Msg$) |
SUB ENTERPHONE (A$, Msg$) |
SUB FASTPHONE (A$, Msg$) |
SUB PressAKey Displays a little box that says Press A Key
If you have mouse, says you may also Click
FUNCTION GETYESORNO Prints "y/n" and waits til you answer with
an appropriate key or mousebutton (Left = Yes)
(4-91: now accepts down arrow as a "No")
5-91: graphic Mouse Prompt comes up the on the first two calls,
if mouse in use (i.e. if NeedDCon = %True). You may or may not
care for it. If not it's easy to disable it.
SUB ENTERYESNO (Yes) Prints a field with a Y or N in it; press
Y or N or [Enter]. Used in data entry windows.
________________________________________________________________________________
What's in BOXES-U.BAS ???????????
-------------------------------
SUB BOXMESSAGE(CornerLin, CornerCol, Margin)
SUB BOXMESSAGE2 (CornerLin, CornerCol, Margin, I$(1), Items%, Maxx)
(prints a box, with lines of text you specify in it.)
SUB POPWINDOW prints a window with entry fields in it and
SUB PWSetUp (Fld$, Z) readies it for data entry. The window is
designed by you as a .PW file, preprocessed
by PWW into an .INC file and included in the
source file. A RESTORE statement must be
executed first. Fld$ is the string label used
in the .PW file to designate each specific
field.
SUB QBOX (L, C, Lines%, Message$, AnsFldLength) (one-field dialog box)
________________________________________________________________________________
What's in MENUS-U.BAS ????????????
-------------------------------
SUB TOPMENU (Lines%, Choice, TLine$) +--------------+
Top of screen menu; select with letter | Now with |
key, cursor and CR, or click and | QUICKCLIK |
pull-down with your Furry Friend. | Buttons !!|
+--------------+
SUB POPMENU (TopKey$,MenuRight,MenuDown,Choice,MLine$,MCode$)
(retained only for compatibility with old code)
SUB SUPERMENU (MenuData$$ (), MenuRight, MenuDown, Choice, Title$, Ky%)
Regular moving-bar menu with mouse or keybd selection,
optional pulldown style or multipage styles, optional
help lines that appear in line 25. Supports multipage
megamenus.
________________________________________________________________________________
What's in FIGDAT-U.BAS ?????????????
-----------------------------------
FUNCTION FigDate&(A$) convert a date to a "Julioid" long-int
FUNCTION WriteDate$ (W&) convert the other way
FUNCTION WkDay$(W&) what day of the week is a given date
FUNCTION YearsSince (D0$) how old is a client born on D0$
FUNCTION FlipDate$ (WrittenDate$) rearrange date for sorting
or indexing (e.g. 900829)
FUNCTION UnflipDate$ (FlippedDate$) unrearrange date into readable form
(e.g. 08-29-90)
________________________________________________________________________________
What's in MISC-U.BAS ???????????
--------------------------------
SUB SCREENPUSH |
SUB SCREENPOP | screen save & restore
SUB RestoreDOSScreen |
SUB PRINTLINE (L$) (fancy printer control -- keep track of pages etc.
NOW: intelligent Print-to-Disk support also!
Pass "START" message to PRINTLINE at the outset,
an "END" message to finish off.)
FUNCTION GetAttr (what is the color at the cursor ??)
FUNCTION ReadParamFor (A$) this reads parameters from the command tail
SUB ClearLine clear a line on screen w/o scrolling
(it seems some BIOS's scroll if you write to 25,80 at all)
FUNCTION IsRodent ' finds if you have a rodent and also resets it
SUB Mouse(MV1, MV2, MV3, MV4)
FUNCTION MouseClicked
FUNCTION GetCurrentDrive$
FUNCTION GetCurrentDir$
FUNCTION GetFreeSpace! (Drv$)
FUNCTION EXIST (File$) needed for PB 2.0 only (use DIR$ in 2.1)
SUB DirFirst (F$, FileSize&, DateCode&, TimeCode&) |
SUB DirNext (F$, FileSize&, DateCode&, TimeCode&) | slower than DIR$
FUNCTION DecodeDate$ (DateCode&) | but able to return
FUNCTION DecodeTime$ (TimeCode&) | date, time, size.
FUNCTION FQFileSpec$ (A$) ' returns path + filename of a file
FUNCTION Cen$ (A$) ' pads a string for centering onscreen
FUNCTION MKU$ (Unsigned&) ' represents a 2-byte unsigned integer.
FUNCTION CVU& (TwoByteNum$) ' Stores it (as a 16-bit int, of course)
SUB BufferStuffer (M$) ' stuff the DOS keyboard buffer w/ a
' command to be executed after your
' PB program ends !!
________________________________________________________________________________
What's in NEW-U.BAS ???????????
-------------------------------
SUB ButtonButton PUBLIC SHARED Creates buttons onscreen for the
user to click on ...
FUNCTION ButtonIsClick (L, C) PUBLIC If the user did click on a button
returns button number (1..5); else
returns 0
SUB MegaMenu (Foo$(), Choices%, Choice, ItemChosen$) Multipage menu from any
size array of choices
FUNCTION PICKADIR$ PUBLIC Menus of subdirectories and files
FUNCTION PICKAFILE$ (D2Use$) PUBLIC respectively; will be multi-paged
if > 23 of either are found on
the disk.
===============================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++
+ __ ____ ___ ____ +
+ | | / | | / |_ +
+ | | \_ |__| | + | * +
+ \__/ __| | | \__| |___ * +
+ +
++++++++++++++++++++++++++++++++++++++++++++++++++
USING BOXMESSAGE
^^^^^^^^^^^^^
The SYNTAX: CALL BOXMESSAGE (CornerLin, CornerCol, Margin)
The INPUT: DATA statements, each containing one line of text to display,
followed by "DATA END". (Don't forget to RESTORE to a label
above the DATA for your box).
The COLORS: BoxColor
The OPTIONS: Positions the left upper corner of the box at CornerLin,
CornerCol -- or for centering on either axis use %Center
for one or both parameters. Errors are trapped so the box
should stay onscreen. Use a margin (1 or more) if you like.
Set FlashBox = %True to flash just the frame.
The OUTPUT: Just the box with text in it.
The RETURN: No return variables.
________________________________________________________________________________
USING ENTERSTRING
^^^^^^^^^^^^^
( ... and its children, ENTER* )
The SYNTAX: CALL ENTERSTRING (Wkg$, FLength, Msg$)
CALL ENTERNUMBER (Wkg#, Masq$, Msg$)
... etc.
The INPUT: Wkg$ is the data string in the field at the outset (may
be empty). FLength is number of chrs that it can hold.
Masq$ is a number formatting string for PRINT-USING use.
The COLORS: FldColor
The OPTIONS: Msg$ may be "" or may contain one or more strings that
will control ENTERSTRING'S behavior.
Msg$ = "Cap" for all uppercase
Msg$ = "Auto" for automatic entry when field is filled
Msg$ = "UpOut" if UpArrow or Shf-Tab keys are to be able
to terminate entry.
Msg$ = "BackOut" if LeftArrow & Backspace keys are to be
able to terminate entry.
Msg$ = "-" if minus sign (negative numbers) are to be
accepted.
InsertStatus is a GLOBAL var -- that way it stays set
where you want it (Insert or Overwrite) between fields.
The OUTPUT: a field FLength characters long, beginning at the present
cursor location, for the user to enter stuff into. It
contains a cursor (big if InsertStatus is %True, else
small) and also the contents of Wkg$ if any. It reponds to
all the customary editing commands including ^arrow-key,
^Y, ^T and ^U. At any time during string entry the operator
can press [CR] or DOWN-ARROW to enter; or [F1] or [F2].
Optional beep for errors.
The RETURN: On exiting sub, Msg$ may be reset as "Left", "Auto", "Up",
"ShfTab", "Down", "Tab", "ESC", "CR", "F2" or "HELP!".
Wkg$ is now whatever the user entered.
________________________________________________________________________________
USING POPWINDOW
^^^^^^^^^^^^^
The SYNTAX: CALL POPWINDOW
The INPUT: The DATA statements in an $INCLUDE file, generated
automatically by PWW.EXE from a window design template file
(*.PW). NOTE: Just don't forget to RESTORE to a label above
the $INCLUDE metastatement for the PopWindow.
The COLORS: WinColor and FldColor
The OPTIONS: None
The OUTPUT: A box resembling the template you made and processed, which
contains text lines and blank fields; and an array in memory
which allows PWSetUp() to do its thing.
The RETURN: None
________________________________________________________________________________
USING PWSetUp
^^^^^^^^^^^^^
The SYNTAX: CALL PWSetUp (FieldName$, Tbl%)
The INPUT: FieldName$ identifies which of the fields in your PopWindow
you are about to use. It must be the same name used to
identify the field in the .PW file that created the PopWindow
now open.
The OUTPUT: The cursor is set to the location of the named field by
means of a LOCATE statement.
The RETURN: Tbl% is the array subscript that pertains to the field named.
The mask string to go with the variable is FieldMask$ (Tbl%).
________________________________________________________________________________
USING TOPMENU
^^^^^^^^^^^^^
The SYNTAX: CALL TOPMENU (Lines%, Choice, TLine$)
The INPUT: DATA statements, each containing one text label to display
as a menu choice, followed by "DATA END". They must have
different first letters, as the hotkey is always the
initial: you press "F" for FILES etc. (Don't forget to
RESTORE to a label above the DATA for your main menu).
To create buttons on-screen, you need to supply data for them
to display and respond to also.
TopOfButtons = 19
ButtonMsg$ (1,1) = " Open"
ButtonMsg$ (1,2) = " QEDIT"
ButtonMsg$ (1,3) = " Alt-A"
Key2Alt (1) = 30 (button will respond to Alt-A,
i.e. CHR$ (0) + CHR$ (30))
Buttons% = 4 (how many buttons? (1..5))
UsingButtons = %True
The COLORS: MenuColor, BarColor, ScrColor
The OPTIONS: Lines% is always 3 -- I've never tried a 2- or 1-line TOPMENU.
If Escapable = %True, the escape key may be pressed as a
response to the menu. TimeOut is a figure in seconds
denoting how long TOPBAR will wait for you to make a choice
(0 = forever). UsingButtons controls button painting and
checking (ON if %True).
The OUTPUT: A menu bar across the top of the screen with several choices
the user can select from in the usual ways -- mouse or key.
The RETURN: Choice will be the selection number. TimeOut (a PUBLIC
variable) will be -1 (%True) if the menu did time out without
user input -- else it's always reset to 0. TLine$ = "HELP!"
if F1 was pressed, "ESC" if Escape, else the name of the
choice chosen.
________________________________________________________________________________
USING SUPERMENU
^^^^^^^^^^^^^
The SYNTAX: CALL SUPERMENU (MenuData$(), MenuRight, MenuDown,_
Choice, Title$, KeyPressed%)
The INPUT:
Each choice on your menu is represented by one string
element in the MenuData$ array. It looks like:
MenuData$(1) = "L LOAD"
-- or --
MenuData$(1) = " LOAD"
The description of each choice -- for example, "LOAD", will
start with the third character of this string. If you are
specifying the hot-key for each choice, put it into the
first character. To let the software number or letter the
items in order for you, MenuData$(1) should have two leading
spaces. (If there are <10 items, numbers are used rather
than letters.) After the last menu item, you must set the
next array element as "END".
PASSING HELP LINES TO MENU: Set MenuHelpLine$() to contain
lines (up to 80 chr long) These will appear at screen
bottom whenever the corresponding menu choice is
highlighted.
The OPTIONS: POSITION OF MENU ONSCREEN: MenuRight moves it right or left
0 is center. MenuDown is 0 for top, up to 22 for bottom.
Errors will be trapped. Vertical centering is gotten by
setting MenuDown = 25. Usually set Choice = 1. Title$ is
title of menu.
Pulldown is a global flag. If true it will behave like a
pulldown should, and if you drag or cursor the selection
bar through the top of the menu frame, SUPERMENU exits
returning the same values as if Escape had been pressed.
PgUp key will only function if the global variable
UsePgUp = %Yes, and similarly for UsePgUp, UseRArrow,
UseLArrow. If there is another page, cursoring or mousing
past the bottom of the displayed page will simulate
pressing PgDn; likewise pulling the menu bar above the top
choice will simulate PgUp. All these globals are reset to
%False after exit, but UseF1 isn't.
The COLORS: MenuColor, BarColor
The RETURN: Choice will hold the choice #. Title$ reset to "".
KeyPressed% will encode the key used to exit the menu
procedure -- %CR, %Esc, %PgUp, %PgDn, %RArrow, %LArrow,
%F1, %F2. If left mouse button was used, it simulates the
CR key, i.e. %CR -- or if Right mouse button = %Esc)
________________________________________________________________________________
USING QBox ()
^^^^^^^^^^^^^
The SYNTAX: QBOX (L, C, Lines%, Message$, AnsFldLength)
The INPUT: Message$ is the one line text string to appear in the box.
AnsFldLength is zero (message only) or the amount of space to
leave for an entry field for user entry. (A dialog box will
consist of a QBox followed immediately by an entry routine
such as ENTERSTRING, ENTERNUMBER, ENTERYESNO or GETYESORNO.
For the latter, leave a space of 8 for the " (y/n) " that will
be printed.)
The OPTIONS: L and C position the box just the same as in BOXMESSAGE. Lines%
is 1 or 3 and determines the type of box (see below).
Set FlashBox = %True to flash just the frame -- for added
noticeability on a cluttery screen (especially useful on
mono displays.)
The COLORS: BoxColor
The OUTPUT: The boxes look like this:
+-----------------------------+
One Line Qbox: | Your Choice: ______________ |
+-----------------------------+
+--------------+
Three Line QBox: | Your Choice: |
| |
| ____________ |
+--------------+
After QBox exits, the cursor (print position) is set at the
beginning of the answer field you set up, ready for the entry
routine to follow.
The RETURN: No return variables ("void", if you will)
________________________________________________________________________________
USING Initialize ()
^^^^^^^^^^^^^
The SYNTAX: Initialize (PrinterType)
The INPUT: %Star10X, %StarNX1000, or %LQ2500 (these printer control code
sets exist so far. You may need to modify them so as to
write your own.)
The OUTPUT: A cleared screen with COLOR set at %Gry, %Blk (7, 0)
The RETURN: Public/global variables:
NeedDCon is %True if a rodent is found
ColorDisplay is %True if the low-memory PEEK shows color
(checked by a write-peek test).
IF ColorDisplay THEN
VideoSeg& = &HB800: CursorTop = 6: CursorBottom = 7
ELSE
VideoSeg& = &HB000: CursorTop = 14: CursorBottom = 15
END IF
InitPrt$, GraphicsChrSetOn$, GraphicsChrSetOff$, BoldPrtOn$, BoldPrtOff$,
ItalicPrtOn$, ItalicPrtOff$, RegPrt$, FastPrt$, WidePrt$, WidePrtOff$,
BigPrtOn$, BigPrtOff$, LQPrt$, DraftPrt$, MicroPrtOn$, MicroPrtOff$,
ElitePrt$, PicaPrt$, ReverseLF$ ... are printer control strings (you guessed
that!). Not all are set for every printer type, and I'm sure they're not all
perfect since I haven't systematically tested them all.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ABOUT THE POWER-BASIC - QEDIT INTERFACE
My new source-code file editor is QEdit -- it's fast, infinitely customizable,
it loads multiple files from the command line and swaps them or windows them,
it can swap itself out to disk or EMS when you shell out to do something else
so little RAM is tied up (that's all the task-switching I even need!) -- it's
shareware and the registered version has workalike emulations for the major
word processing packages. If you start QEdit with a command-line switch of
/G1234 it jumps right to line 1234 of your file. So, perfect -- I can write
batch files on the fly to handle both runtime errors and compiler errors.
PQ.BAT and ERFIND.EXE do just that. They are documented within the source
code.
Your main file should set GoToSourceFile = %True and say ON ERROR GOTO Oops;
also set string values for SourceFile$ & SourceDir$.
The temporary batch files thus created are written to a RAMDisk. To allow both
the batch file and the PB program to locate that drive I set a DOS environment
variable, SET RD=D or SET RD=E or whatever.
I include a file, 2ERRORS.BAS, containing both a compile error and a runtime
error. After you download QEdit, just type PQ 2ERRORS. QEdit will open the
.BAS file. Don't fix it now, just exit and see what happens.
Oh yes, I almost forgot: these files call ERROR.EXE also. Download it from the
Power Basic Forum libraries. Rodney Jones wrote it -- very helpful, with no
hoopla at all. It displays the explanation of any runtime error in Power Basic.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
POWER BASIC PROGRAMMERS: IF YOU LIKE IT, PASS IT ON.
Your feedback is welcomed -- write to 2097 7th St. in
Oakland, Ca. 94607 -- or via the CompuServe PCVENB
Forum (# 71121,776)
-- Howard Ballinger